﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>GiveFeedback</title>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8" /><link href="../demo.css" rel="stylesheet" type="text/css" />

    
    <script src="../../scripts/boot.js" type="text/javascript"></script>
    
    

</head>
<body>
    <h1>GiveFeedback </h1>      

    
    
    <ul id="tree1" class="mini-tree" url="../data/listTree.txt" style="width:200px;padding:5px;" 
        showTreeIcon="true" textField="text" idField="id" parentField="pid" resultAsTree="false"          
        allowDrag="true" allowDrop="true" ongivefeedback="onGiveFeedback"
        >
    </ul>
    
        
    <script type="text/javascript">
        mini.parse();

        function onGiveFeedback(e) {
            var tree = e.sender;
            var node = e.node;              //被拖拽的节点
            var targetNode = e.targetNode;  //目标投放节点
            var effect = e.effect;          //投放方式：add|before|after

            var p1 = tree.getParentNode(node);
            var p2 = tree.getParentNode(targetNode);

            if (p1 != p2 || effect == "add") {
                e.effect = "no";
            }            
        }
    </script>

    <div class="description">
        <h3>Description</h3>
        <p>            
            限制节点只能平级移动。通过处理GiveFeedback事件，可以实现任意逻辑的拖拽投放效果。
        </p>
    </div>
</body>
</html>